package com.ruoyi.exhibition.service.impl;

import java.beans.Transient;
import java.util.List;

import com.ruoyi.artworks.domain.Artworks;
import com.ruoyi.course.domain.CourseCla;
import com.ruoyi.exhibition.dao.ClaStuDao;
import com.ruoyi.exhibition.domain.ExhiForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exhibition.mapper.ExhibitionMapper;
import com.ruoyi.exhibition.domain.Exhibition;
import com.ruoyi.exhibition.service.IExhibitionService;

/**
 * 投票管理Service业务层处理
 * 
 * @author hyl
 * @date 2025-06-20
 */
@Service
public class ExhibitionServiceImpl implements IExhibitionService 
{
    @Autowired
    private ExhibitionMapper exhibitionMapper;

    /**
     * 查询投票管理
     * 
     * @param exhId 投票管理主键
     * @return 投票管理
     */
    @Override
    public Exhibition selectExhibitionByExhId(Long exhId)
    {
        return exhibitionMapper.selectExhibitionByExhId(exhId);
    }

    /**
     * 查询投票管理列表
     * 
     * @param exhibition 投票管理
     * @return 投票管理
     */
    @Override
    public List<Exhibition> selectExhibitionList(Exhibition exhibition)
    {
        return exhibitionMapper.selectExhibitionList(exhibition);
    }

    /**
     * 新增投票管理
     * 
     * @param exhibition 投票管理
     * @return 结果
     */
    @Override
    public int insertExhibition(Exhibition exhibition)
    {
        return exhibitionMapper.insertExhibition(exhibition);
    }

    /**
     * 修改投票管理
     * 
     * @param exhibition 投票管理
     * @return 结果
     */
    @Override
    public int updateExhibition(Exhibition exhibition)
    {
        return exhibitionMapper.updateExhibition(exhibition);
    }

    /**
     * 批量删除投票管理
     * 
     * @param exhIds 需要删除的投票管理主键
     * @return 结果
     */
    @Override
    public int deleteExhibitionByExhIds(Long[] exhIds)
    {
        return exhibitionMapper.deleteExhibitionByExhIds(exhIds);
    }

    /**
     * 删除投票管理信息
     * 
     * @param exhId 投票管理主键
     * @return 结果
     */
    @Override
    public int deleteExhibitionByExhId(Long exhId)
    {
        return exhibitionMapper.deleteExhibitionByExhId(exhId);
    }

    @Override
    public List<CourseCla> selectAllClass(CourseCla courseCla) {

        return exhibitionMapper.selectAllClass(courseCla);
    }

    @Override
    public List<ClaStuDao> selectAllStudent(ClaStuDao claStuDao) {
        return exhibitionMapper.selectAllStudent(claStuDao);
    }

    @Override
    public List<Artworks> selectAllWorks(Artworks artworks) {
        return exhibitionMapper.selectAllWorks(artworks);
    }

    @Transient
    @Override
    public int insertWorks(List<ExhiForm> exhiForm) {
        List<Integer> integers = exhibitionMapper.countFormPeople(exhiForm.get(0).getExhId());
        exhibitionMapper.updateSum(integers.size(), exhiForm.get(0).getExhId());
        return  exhibitionMapper.insertWorks(exhiForm);
    }
}
